home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
gnu
/
gcctest
/
tests05.zoo
/
trandm.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-03-28
|
522b
|
40 lines
#include <stdio.h>
#if __STDC__
#include <stdlib.h>
#include <unistd.h>
#else
#ifdef sun
#define RAND_MAX 0x7fffffff
#endif
#endif
#if !__STDC__
long labs(x)
long x;
{
return (x < 0)? -x : x;
}
#endif
#ifdef __hpux
#define random rand
#else
extern long random();
#endif
int main()
{
register long i, h, t;
for (h = 0, t = 0, i = 0; i < 20000; i++)
if(random() < (RAND_MAX/2))
h++;
else
t++;
if(labs(h-t) > 2)
{
printf("%ld %ld\n", h , t);
return 1;
}
return 0;
}